/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Vue;

import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.geom.Rectangle2D;
import javax.swing.JLabel;

/**
 *
 * @author Gloire
 */
public class LabelCase extends JLabel{
    private int color;
    
    public LabelCase(char c, int points, Font font){
        super((char)(c-32)+"");
        setFont(font);
    }
    
    public LabelCase(char c, int points){
        super((char)(c-32)+"");
    }
    
    public void paint(Graphics arg) {
		Graphics2D g = (Graphics2D) arg;

		FontRenderContext frc = g.getFontRenderContext();
		GlyphVector gv = getFont().createGlyphVector(frc, getText());
		Rectangle2D box = gv.getVisualBounds();

		int xOff = (int) -box.getX();
		int yOff = (int) -box.getY();

		Shape shape = gv.getOutline(xOff, yOff);

		g.setClip(null);
		g.setStroke(new BasicStroke(2f));
		g.setColor((color == 0 ? Color.WHITE : color == 1 ? Color.ORANGE
				: color == 2 ? Color.cyan : Color.red));

		g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		g.draw(shape);

		g.dispose();

	}
    
    public void setColor(int color) {
		this.color = color;
	}
}
